{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "b1c0457f-855e-4044-bf90-97e7d2b38a9f",
   "metadata": {},
   "source": [
    "Chapter 08\n",
    "# 两个输入、多个输出函数\n",
    "Book_1《编程不难》 | 鸢尾花书：从加减乘除到机器学习 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "a3238c05-8ff5-400b-843e-8d00690bcca4",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 自定义函数\n",
    "def arithmetic_operations(a, b):\n",
    "    add = a + b\n",
    "    sub = a - b\n",
    "    mul = a * b\n",
    "    div = a / b\n",
    "    return add, sub, mul, div"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "5ae2c0c2-5852-40c9-89a8-d5ee59c9212c",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 调用函数并输出结果\n",
    "a, b = 10, 5\n",
    "result = arithmetic_operations(a, b)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "d5773ff3-b4cd-47e8-b884-2bff521ab360",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Addition:  15\n",
      "Subtraction:  5\n",
      "Multiplication:  50\n",
      "Division:  2.0\n"
     ]
    }
   ],
   "source": [
    "print(\"Addition: \", result[0])\n",
    "print(\"Subtraction: \", result[1])\n",
    "print(\"Multiplication: \", result[2])\n",
    "print(\"Division: \", result[3])"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
